package org.hk.springMVC.handler;

import org.hk.springMVC.bean.Car;
import org.hk.springMVC.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName: CarController
 * @Date: 2025/7/12   10:16
 * @Description: 处理器
 * @Author: hk
 */
@Controller
public class CarController {
    @Autowired
    private CarService carService;

    @RequestMapping("/")
    private String init(){
        return "index";
    }

    @RequestMapping("/car/{id}")
    @ResponseBody
    public Car getInfo(@PathVariable("id") Long id){
        return carService.selectCarInfo(id);

    }

}
